package com.demo;

public class Factory {
    private Factory() {super();}
    private static Factory factory = null;
    public static Factory getInstance() {
        if(factory==null) {
            factory = new Factory();
        }
        return factory;
    }
    public Command create(String cmd) {
        if(cmd.equals("chkCard")) return new ChkCard();
        if(cmd.equals("chkBuffer")) return new ChkBuffer();
        if(cmd.equals("queryStats")) return new QueryStats();
        return null;
    }
}
